#include <iostream>
using std::cout;
using std::endl;

class Point
{
public:
	Point(double x,double y)
	: _x(x)
	, _y(y)
	{}

	//定义一个成员函数模板
	//将_x转换成目标类型
	template <class T = int>
	T convert()
	{
		return (T)_x;
	}


    template <class T,int kBase = 10>
    T multiply(T t1);

private:
	double _x;
	double _y;
};

template <class T,int kBase>
T Point::multiply(T t1){
    return t1 * _x * _y * kBase;
}


void test0(){
    Point pt(1.42,1.42);
    cout << pt.convert<int>() << endl;
    cout << pt.convert() << endl;
    cout << pt.multiply(20) << endl; 
}

int main(void){
    test0();
    return 0;
}
